package com.tencent;

/**
 * Description:
 * Copyright:   Copyright (c)2019
 * Company:     zefu
 *
 * @author: 张李鑫
 * @version: 1.0
 * Create at:   2021-09-30 15:34:25
 * <p>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2021-09-30     张李鑫                     1.0         1.0 Version
 */
public class MergeKLists {
    static class ListNode {
        int val;
        ListNode next;

        public ListNode(int val) {
            this.val = val;
        }

        public ListNode(int val, ListNode next) {
            this.val = val;
            this.next = next;
        }
    }

    public ListNode mergeKLists(ListNode[] lists) {
        if (lists.length < 2) {
            return lists[0];
        }
        ListNode listNode = lists[0];
        for (int i = 1; i < lists.length; i++) {
            while (listNode.next != null) {
                listNode = listNode.next;
            }
            listNode.next = lists[i];
        }
        return null;
    }



}
